package net.zjitc.controller;

import net.zjitc.utils.dispacher.URLMapping;

import javax.servlet.ServletException;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;

/**
 * Created by Administrator on 2017/11/8.
 */
public class ProductController {
   @URLMapping(url = "/addProduct")
    public String add(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
       request.setAttribute("msg","这是我的测试");
       String p = request.getParameter("username");
       request.setAttribute("p",p);
      // request.getRequestDispatcher("/msg.jsp").forward(request,response);
       return "/msg.jsp";
    }
    @URLMapping(url = "/editUIProduct")
    public String editUi(HttpServletRequest request, HttpServletResponse response){
    return null;
    }
    @URLMapping(url = "/editProduct")
    public String edit(HttpServletRequest request, HttpServletResponse response) throws IOException {
    // response.sendRedirect(request.getContextPath()+"/list.jsp");
     return "Redirect:"+request.getContextPath()+"/list.jsp";
    }
    @URLMapping(url = "/deleteProduct")
    public String delete(HttpServletRequest request, HttpServletResponse response){
     return null;
    }
    @URLMapping(url = "/findAllProduct")
    public String findAll(HttpServletRequest request, HttpServletResponse response){
     return null;
    }

}
